var Mp3 = require('../model/mp3')
var _ = require('underscore');

exports.fetch = function(req, res) {
    Mp3.fetch(function(err, mp3s) {
        if (err) {
            console.log(err);
        } else {
            res.render('admin/mp3', {
                mp3s: mp3s
            });
        }
    });
}
exports.save = function(req, res) {
    var mp3Obj = req.body.mp3;

    if (mp3Obj) {
        var mp3 = new Mp3(mp3Obj);
        mp3.save(function(err) {
            if (err) {
                console.log(err);
            } else {
                res.redirect('/admin/mp3');
            }
        });
    }
}

exports.del=function(req,res){
    res.send({
        "test":true
    })
}
